<template>
	<view class="content">
		<text class="iconfont icon-changyongicon-"></text>
		<text class="tit">{{title}}</text>
		
		<view class="btn-group">
			<button class="mix-btn hollow" v-if="act == 'changzu' && seconds > 0">{{seconds}}{{changzu_btn}}</button>
			<button  @tap="to_changzu()" class="mix-btn hollow" v-else-if="act == 'changzu'">{{changzu_btn}}</button>
			<button  @tap="to_duanzu()" class="mix-btn hollow" v-else-if="act == 'duanzu'">回到首页重新扫码</button>
			<button  @tap="param_to_url2('me')" class="mix-btn hollow" v-else>返回个人中心</button>
		</view>
	</view>
</template>

<script>
	var that;
	export default {
		data() {
			return {
				title:'支付成功',
				act:'',
				czddRowid:'',
				yajinRowid:'',
				zujinRowid:'',
				rowId:'',
				seconds:5,
				changzu_btn:'秒后前往支付租金'
			}
		},
		onLoad(options) {
			that = this;
			if(options.act == 'pub'){
				that.title = '发布成功';
				uni.setNavigationBarTitle({
					title:'发布成功'
				});
			}
			if(options.act == 'changzu'){
				that.czddRowid = options.czddRowid;
				that.yajinRowid = options.yajinRowid;
				that.zujinRowid = options.zujinRowid;
				that.title = '押金支付成功';
				setTimeout(function(){
					that.daojishi();
				},1000);
			}
			if(options.act == 'duanzu'){
				that.title = '押金支付成功';
			}
			that.act = options.act;
		},
		methods: {
			daojishi(){
				if(that.seconds <= 0){
					that.changzu_btn = '前往支付租金';
					return false;
				}
				that.seconds--;
				setTimeout(function(){
					that.daojishi();
				},1000);
			},
			to_renmai(){
				uni.redirectTo({
					url:'/pages/renmai/renmai_manage'
				});
			},
			to_changzu(){
				if(that.seconds > 0){
					return false;
				}
				uni.redirectTo({
					url:'yuyue_to_pay?czddRowid='+that.czddRowid+'&yajinRowid='+that.yajinRowid+'&zujinRowid='+that.zujinRowid+'&rowid='+that.rowId
				});
			},
			to_duanzu(){
				uni.switchTab({
					url:'/pages/index/index'
				});
			},
			param_to_url2(url){
				uni.switchTab({
					url:"/pages/index/me"
				});
			}
		}
	}
</script>

<style lang='scss'>
	.content{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	.icon-changyongicon-{
		font-size: 80rpx;
		color: #fff;
		margin-top: 100upx;
		border-radius: 100%;
		display: inline-block;
		width: 120rpx;
		height: 120rpx;
		text-align: center;
		line-height: 120rpx;
		font-weight: 600;
		background-color: #0068F7;
	}
	.success-icon{
		font-size: 160upx;
		color: #fa436a;
		margin-top: 100upx;
	}
	.tit{
		margin-top: 20rpx;
		font-size: 38upx;
		color: #303133;
	}
	.btn-group{
		padding-top: 100upx;
	}
	.mix-btn {
		margin-top: 30upx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 600upx;
		height: 80upx;
		font-size: 32rpx;
		color: #fff;
		background-color:#009966;
		border-radius: 10upx;
		&.hollow{
			background: #fff;
			color: #303133;
			border: 1px solid #ccc;
		}
	}
</style>
